/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javauil;

import java.awt.Container;
import java.awt.EventQueue;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.ButtonGroup;

import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;

import javax.swing.JTextField;


/**
 *
 * @author MS
 */
public class test1 {
    public static void main(String args[])
    {
       Runnable runner = new Runnable() {
			public void run() {
				JFrame frame = new JFrame("Hello Swing");   //Tao Frame co ten Hello Swing
				//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   //Thoat khi cho x tren jFrame
                                //frame.setLayout(new FlowLayout());
                               // frame.setLayout(new HorizBagLayout());
                                frame.setLayout(new GridBagLayout());
				Container contentPane =frame.getContentPane();  //lay phan mau xam trong jframe
                                GridBagConstraints c=new GridBagConstraints();  //Tao Layout cho phep dat cac cong cu theo toa do
                                c.gridx=0;
                                c.gridy=0;


                                JLabel lbldn=new JLabel("Dang Xuat");
                                contentPane.add(lbldn,c);

                                 c=new GridBagConstraints();
                                 c.gridx=1;
                                 c.gridy=1;
                                 JTextField txtdn=new JTextField(10);
                                 contentPane.add(txtdn,c);


                                 JLabel lbmk =new JLabel("Mat Khau");
                                 c=new GridBagConstraints();
                                 c.gridx=0;
                                 c.gridy=1;
                                 contentPane.add(lbmk,c);


                                 JTextField txtmt=new JPasswordField(10);
                                 c=new GridBagConstraints();
                                 c.gridx=1;
                                 c.gridy=1;
                                 contentPane.add(txtmt);

                                 c=new GridBagConstraints();
                                 c.gridx=0;
                                 c.gridy=3;
                                JButton btnDN=new JButton("Dang Nhap");
                                contentPane.add(btnDN,c);

                                c=new GridBagConstraints();
                                c.gridx=1;
                                c.gridy=3;


                                JButton btnMK=new JButton("Thoat");
                                contentPane.add(btnMK,c);

                                c=new GridBagConstraints();
                                c.gridx=2;
                                c.gridy=6;


                                JTextArea TxtAra1=new JTextArea(10,10);
                                JScrollPane SclPn1=new JScrollPane(TxtAra1);    //Tao thanh truot cho textArea,khi go chu vao trong do nhieu se hien ra thanh truot
                                contentPane.add(SclPn1,c);

                                c=new GridBagConstraints();
                                c.gridx=2;
                                c.gridy=7;

                                JEditorPane EdtPn1=new JEditorPane();
                                contentPane.add(EdtPn1,c);



                                JRadioButton oneBtn=new JRadioButton("Rb1");
                                oneBtn.setName("WrongAnswer");
                                JRadioButton twoBtn=new JRadioButton("Rb2");
                                oneBtn.setName("bnt2");
                                JRadioButton threeBtn=new JRadioButton("Rb3");
                                oneBtn.setName("bnt3");

                                ButtonGroup g=new ButtonGroup();
                                g.add(oneBtn);
                                g.add(twoBtn);
                                g.add(threeBtn);

                                c=new GridBagConstraints();
                                c.gridx=2;
                                c.gridy=8;
                                contentPane.add(oneBtn,c);

                                c=new GridBagConstraints();
                                c.gridx=2;
                                c.gridy=9;
                                contentPane.add(twoBtn,c);

                                c=new GridBagConstraints();
                                c.gridx=2;
                                c.gridy=10;
                                contentPane.add(threeBtn,c);

                                c= new GridBagConstraints();
                                c.gridx=2;
                                c.gridy=11;



                                HelloMouseListener Hello=new HelloMouseListener();
                                JButton Bnt1=new JButton("Bnt1");
                                Bnt1.addMouseListener(Hello);
                                contentPane.add(Bnt1,c);

				frame.setSize(500,500);
				frame.setVisible(true);




			}
		};
		EventQueue.invokeLater(runner);
    }
//de cac component cach nhau Insets i=new Insets(20,20,20,20)
    //lbl.insest=i;
}
